using HKB.Common;
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Diagnostics;
namespace HKB.Data.Dal.S_RequestTableAdapters
{
	[GeneratedCode("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"), DataObject(true), HelpKeyword("vs.data.TableAdapter"), Designer("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), DesignerCategory("code"), ToolboxItem(true)]
	public class HLShop_RequestTableAdapter : Component
	{
		private SqlDataAdapter _adapter;
		private SqlConnection _connection;
		private SqlCommand[] _commandCollection;
		private bool _clearBeforeFill;
		[System.Diagnostics.DebuggerNonUserCode]
		private SqlDataAdapter Adapter
		{
			get
			{
				if (this._adapter == null)
				{
					this.InitAdapter();
				}
				return this._adapter;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		internal SqlConnection Connection
		{
			get
			{
				if (this._connection == null)
				{
					this.InitConnection();
				}
				return this._connection;
			}
			set
			{
				this._connection = value;
				if (this.Adapter.InsertCommand != null)
				{
					this.Adapter.InsertCommand.Connection = value;
				}
				if (this.Adapter.DeleteCommand != null)
				{
					this.Adapter.DeleteCommand.Connection = value;
				}
				if (this.Adapter.UpdateCommand != null)
				{
					this.Adapter.UpdateCommand.Connection = value;
				}
				for (int i = 0; i < this.CommandCollection.Length; i++)
				{
					if (this.CommandCollection[i] != null)
					{
						this.CommandCollection[i].Connection = value;
					}
				}
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		protected SqlCommand[] CommandCollection
		{
			get
			{
				if (this._commandCollection == null)
				{
					this.InitCommandCollection();
				}
				return this._commandCollection;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		public bool ClearBeforeFill
		{
			get
			{
				return this._clearBeforeFill;
			}
			set
			{
				this._clearBeforeFill = value;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		public HLShop_RequestTableAdapter()
		{
			this.ClearBeforeFill = true;
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitAdapter()
		{
			this._adapter = new SqlDataAdapter();
			DataTableMapping dataTableMapping = new DataTableMapping();
			dataTableMapping.SourceTable = "Table";
			dataTableMapping.DataSetTable = "HLShop_Request";
			dataTableMapping.ColumnMappings.Add("RequestID", "RequestID");
			dataTableMapping.ColumnMappings.Add("RequesterID", "RequesterID");
			dataTableMapping.ColumnMappings.Add("RequestCategoryID", "RequestCategoryID");
			dataTableMapping.ColumnMappings.Add("RequestTitle", "RequestTitle");
			dataTableMapping.ColumnMappings.Add("Description", "Description");
			dataTableMapping.ColumnMappings.Add("UploadImageUrl", "UploadImageUrl");
			dataTableMapping.ColumnMappings.Add("RequestNumber", "RequestNumber");
			dataTableMapping.ColumnMappings.Add("ValidDate", "ValidDate");
			dataTableMapping.ColumnMappings.Add("Price", "Price");
			dataTableMapping.ColumnMappings.Add("RequestPlace", "RequestPlace");
			dataTableMapping.ColumnMappings.Add("Remark", "Remark");
			dataTableMapping.ColumnMappings.Add("RequestClick", "RequestClick");
			dataTableMapping.ColumnMappings.Add("RequestType", "RequestType");
			dataTableMapping.ColumnMappings.Add("RequestKey", "RequestKey");
			dataTableMapping.ColumnMappings.Add("CreateDate", "CreateDate");
			dataTableMapping.ColumnMappings.Add("EnableRequest", "EnableRequest");
			dataTableMapping.ColumnMappings.Add("LeftTime", "LeftTime");
			dataTableMapping.ColumnMappings.Add("EndDate", "EndDate");
			dataTableMapping.ColumnMappings.Add("unit", "unit");
			this._adapter.TableMappings.Add(dataTableMapping);
			this._adapter.DeleteCommand = new SqlCommand();
			this._adapter.DeleteCommand.Connection = this.Connection;
			this._adapter.DeleteCommand.CommandText = "DELETE FROM [HLShop_Request] WHERE (([RequestID] = @Original_RequestID))";
			this._adapter.DeleteCommand.CommandType = CommandType.Text;
			this._adapter.DeleteCommand.Parameters.Add(new SqlParameter("@Original_RequestID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "RequestID", DataRowVersion.Original, false, null, "", "", ""));
			this._adapter.InsertCommand = new SqlCommand();
			this._adapter.InsertCommand.Connection = this.Connection;
			this._adapter.InsertCommand.CommandText = "INSERT INTO [HLShop_Request] ([RequesterID], [RequestCategoryID], [RequestTitle], [Description], [UploadImageUrl], [RequestNumber], [ValidDate], [Price], [RequestPlace], [Remark], [RequestClick], [RequestType], [RequestKey], [CreateDate], [EnableRequest], [EndDate], [unit]) VALUES (@RequesterID, @RequestCategoryID, @RequestTitle, @Description, @UploadImageUrl, @RequestNumber, @ValidDate, @Price, @RequestPlace, @Remark, @RequestClick, @RequestType, @RequestKey, @CreateDate, @EnableRequest, @EndDate, @unit)";
			this._adapter.InsertCommand.CommandType = CommandType.Text;
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@RequesterID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "RequesterID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@RequestCategoryID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "RequestCategoryID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@RequestTitle", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "RequestTitle", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Description", SqlDbType.Text, 0, ParameterDirection.Input, 0, 0, "Description", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@UploadImageUrl", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "UploadImageUrl", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@RequestNumber", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "RequestNumber", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ValidDate", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "ValidDate", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Price", SqlDbType.Decimal, 0, ParameterDirection.Input, 19, 2, "Price", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@RequestPlace", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "RequestPlace", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Remark", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "Remark", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@RequestClick", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "RequestClick", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@RequestType", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "RequestType", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@RequestKey", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "RequestKey", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@CreateDate", SqlDbType.DateTime, 0, ParameterDirection.Input, 0, 0, "CreateDate", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@EnableRequest", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "EnableRequest", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@EndDate", SqlDbType.DateTime, 0, ParameterDirection.Input, 0, 0, "EndDate", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@unit", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "unit", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand = new SqlCommand();
			this._adapter.UpdateCommand.Connection = this.Connection;
			this._adapter.UpdateCommand.CommandText = "UPDATE [HLShop_Request] SET [RequesterID] = @RequesterID, [RequestCategoryID] = @RequestCategoryID, [RequestTitle] = @RequestTitle, [Description] = @Description, [UploadImageUrl] = @UploadImageUrl, [RequestNumber] = @RequestNumber, [ValidDate] = @ValidDate, [Price] = @Price, [RequestPlace] = @RequestPlace, [Remark] = @Remark, [RequestClick] = @RequestClick, [RequestType] = @RequestType, [RequestKey] = @RequestKey, [CreateDate] = @CreateDate, [EnableRequest] = @EnableRequest, [EndDate] = @EndDate, [unit] = @unit WHERE (([RequestID] = @Original_RequestID))";
			this._adapter.UpdateCommand.CommandType = CommandType.Text;
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@RequesterID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "RequesterID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@RequestCategoryID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "RequestCategoryID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@RequestTitle", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "RequestTitle", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Description", SqlDbType.Text, 0, ParameterDirection.Input, 0, 0, "Description", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@UploadImageUrl", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "UploadImageUrl", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@RequestNumber", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "RequestNumber", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ValidDate", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "ValidDate", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Price", SqlDbType.Decimal, 0, ParameterDirection.Input, 19, 2, "Price", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@RequestPlace", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "RequestPlace", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Remark", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "Remark", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@RequestClick", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "RequestClick", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@RequestType", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "RequestType", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@RequestKey", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "RequestKey", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@CreateDate", SqlDbType.DateTime, 0, ParameterDirection.Input, 0, 0, "CreateDate", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@EnableRequest", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "EnableRequest", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@EndDate", SqlDbType.DateTime, 0, ParameterDirection.Input, 0, 0, "EndDate", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@unit", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "unit", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Original_RequestID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "RequestID", DataRowVersion.Original, false, null, "", "", ""));
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitConnection()
		{
			this._connection = new SqlConnection();
			this._connection.ConnectionString = Conn.CurrenConnectionStrings;
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitCommandCollection()
		{
			this._commandCollection = new SqlCommand[5];
			this._commandCollection[0] = new SqlCommand();
			this._commandCollection[0].Connection = this.Connection;
			this._commandCollection[0].CommandText = "SELECT RequestID, RequesterID, RequestCategoryID, RequestTitle, Description, \r\n      UploadImageUrl, RequestNumber, ValidDate, Price, RequestPlace, Remark, \r\n      RequestClick, RequestType, RequestKey, CreateDate, EnableRequest, DATEDIFF(s, \r\n      GETDATE(),  EndDate) AS LeftTime, EndDate,unit\r\nFROM HLShop_Request\r\nOrder By LeftTime Asc";
			this._commandCollection[0].CommandType = CommandType.Text;
			this._commandCollection[1] = new SqlCommand();
			this._commandCollection[1].Connection = this.Connection;
			this._commandCollection[1].CommandText = "DELETE FROM [HLShop_Request] WHERE (([RequestID] = @RequestID))";
			this._commandCollection[1].CommandType = CommandType.Text;
			this._commandCollection[1].Parameters.Add(new SqlParameter("@RequestID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "RequestID", DataRowVersion.Original, false, null, "", "", ""));
			this._commandCollection[2] = new SqlCommand();
			this._commandCollection[2].Connection = this.Connection;
			this._commandCollection[2].CommandText = "PR_GetRequestListBySQL";
			this._commandCollection[2].CommandType = CommandType.StoredProcedure;
			this._commandCollection[2].Parameters.Add(new SqlParameter("@RETURN_VALUE", SqlDbType.Int, 4, ParameterDirection.ReturnValue, 10, 0, null, DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[2].Parameters.Add(new SqlParameter("@SQL", SqlDbType.VarChar, 5000, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[3] = new SqlCommand();
			this._commandCollection[3].Connection = this.Connection;
			this._commandCollection[3].CommandText = "SELECT RequestID, RequesterID, RequestCategoryID, RequestTitle, Description, \r\n      UploadImageUrl, RequestNumber, ValidDate, Price, RequestPlace, Remark, \r\n      RequestClick, RequestType, RequestKey, CreateDate, EnableRequest, DATEDIFF(s, \r\n      GETDATE(),  EndDate) AS LeftTime, EndDate,unit\r\nFROM HLShop_Request\r\nWHERE (RequestID = @Requestid)";
			this._commandCollection[3].CommandType = CommandType.Text;
			this._commandCollection[3].Parameters.Add(new SqlParameter("@Requestid", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "RequestID", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[4] = new SqlCommand();
			this._commandCollection[4].Connection = this.Connection;
			this._commandCollection[4].CommandText = "SELECT CreateDate, Description, EnableRequest, EndDate, DATEDIFF(s, GETDATE(), EndDate) AS LeftTime, Price, Remark, RequestCategoryID, RequestClick, RequestID, RequestKey, RequestNumber, RequestPlace, RequestTitle, RequestType, RequesterID, Unit, UploadImageUrl, ValidDate FROM HLShop_Request WHERE (RequesterID = @UserID) ORDER BY LeftTime";
			this._commandCollection[4].CommandType = CommandType.Text;
			this._commandCollection[4].Parameters.Add(new SqlParameter("@UserID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "RequesterID", DataRowVersion.Current, false, null, "", "", ""));
		}
		[DataObjectMethod(DataObjectMethodType.Select, true), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual S_Request.HLShop_RequestDataTable GetAllRequest()
		{
			this.Adapter.SelectCommand = this.CommandCollection[0];
			S_Request.HLShop_RequestDataTable hLShop_RequestDataTable = new S_Request.HLShop_RequestDataTable();
			this.Adapter.Fill(hLShop_RequestDataTable);
			return hLShop_RequestDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual S_Request.HLShop_RequestDataTable GetGetRequestListBySQL(string SQL)
		{
			this.Adapter.SelectCommand = this.CommandCollection[2];
			if (SQL == null)
			{
				this.Adapter.SelectCommand.Parameters[1].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[1].Value = SQL;
			}
			S_Request.HLShop_RequestDataTable hLShop_RequestDataTable = new S_Request.HLShop_RequestDataTable();
			this.Adapter.Fill(hLShop_RequestDataTable);
			return hLShop_RequestDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual S_Request.HLShop_RequestDataTable GetRequestByID(int Requestid)
		{
			this.Adapter.SelectCommand = this.CommandCollection[3];
			this.Adapter.SelectCommand.Parameters[0].Value = Requestid;
			S_Request.HLShop_RequestDataTable hLShop_RequestDataTable = new S_Request.HLShop_RequestDataTable();
			this.Adapter.Fill(hLShop_RequestDataTable);
			return hLShop_RequestDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual S_Request.HLShop_RequestDataTable GetRequestByRequesterID(int UserID)
		{
			this.Adapter.SelectCommand = this.CommandCollection[4];
			this.Adapter.SelectCommand.Parameters[0].Value = UserID;
			S_Request.HLShop_RequestDataTable hLShop_RequestDataTable = new S_Request.HLShop_RequestDataTable();
			this.Adapter.Fill(hLShop_RequestDataTable);
			return hLShop_RequestDataTable;
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(S_Request.HLShop_RequestDataTable dataTable)
		{
			return this.Adapter.Update(dataTable);
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(S_Request dataSet)
		{
			return this.Adapter.Update(dataSet, "HLShop_Request");
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(DataRow dataRow)
		{
			return this.Adapter.Update(new DataRow[]
			{
				dataRow
			});
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(DataRow[] dataRows)
		{
			return this.Adapter.Update(dataRows);
		}
		[DataObjectMethod(DataObjectMethodType.Delete, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int DeleteRequest(int RequestID)
		{
			SqlCommand sqlCommand = this.CommandCollection[1];
			sqlCommand.Parameters[0].Value = RequestID;
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			int result;
			try
			{
				result = sqlCommand.ExecuteNonQuery();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			return result;
		}
	}
}
